package cz.cvut.kadledav.paa.knapsack.bo;

/**
 * User: David Kadlecek
 * Date: 7.10.13
 */
public class ComputedInstanceSolution extends InstanceSolution {

    private long time;

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public boolean isSameAsGiven(InstanceSolution s){
        if(getInstanceId() != s.getInstanceId()){
            throw new RuntimeException("try to compare two solutions for different instances "+getInstanceId()+":"+s.getInstanceId());
        }
        if(getPrice() != s.getPrice()){
            return false;
        }
        return true;

//      only if ONE optimal solution exist - problem in the instance 9126 and 9050
//        if(getItemIds()== null){
//            throw new RuntimeException("null ids for computed solution with id:"+getInstanceId());
//        }
//        if(s.getItemIds()==null){
//            throw new RuntimeException("null ids for solution with id:"+getInstanceId());
//        }
//        return getItemIds().containsAll(s.getItemIds()) && s.getItemIds().containsAll(getItemIds());
    }

}
